﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CsplPractice
{
    class QueryClass
    {
        public static void Main(string[] args)
        {
            //int[] numbers = new int[7] { 0,1,2,3,4,5,6};
            //IList<int> eventNumber = new List<int>();

            ////for (int i = 0; i < numbers.Length; i++)
            ////    {
            ////        if(numbers[i]%2==0)
            ////            eventNumber.Add(numbers[i]);
            ////    }

            //var a = numbers.Where(num => num % 2 == 0);
            
            //foreach (int item in numbers){
            //    if(item%2==0)
            //        eventNumber.Add(item);
            //}

            //var eventNumbers=
            //    from num in numbers
            //    where num %2==0
            //    select num;

            //for (int i = 0; i < eventNumber.ToArray().Length; i++)
            //{
            //    Console.WriteLine("{0,1}",eventNumbers.ElementAt(i));
            //}
            //Console.Read();


            //IList<Point> points = new List<Point>();

            //points.Add(new Point { x = 1, y = 2 });
            //points.Add(new Point { x = 1, y = 3 });
            //points.Add(new Point { x = 1, y = 4 });
            //points.Add(new Point { x = 2, y = 2 });
            //points.Add(new Point { x = 2, y = 3 });

            //var pointX1 = points.Where(item=>item.y ==4);

            //foreach (var item in pointX1)
            //{
            //    System.Console.WriteLine("point x={0}, y={1}",item.x, item.y);
            //}

            IList<Student> students = new List<Student>();

            students.Add(new Student { Id = "12345", Name = "SiX", Faculty = "Electrical Engineering", Major = "Electro"});
            students.Add(new Student { Id = "12346", Name = "SiY", Faculty = "Electrical Engineering", Major = "Power" });
            students.Add(new Student { Id = "12347", Name = "SiA", Faculty = "Electrical Engineering", Major = "Information System" });

            int numbers = students.Count(s => s.Faculty == "Electrical Engineering");

            System.Console.WriteLine(numbers);

        }
    }
}
